#ifndef RENDERTARGET_H
#define RENDERTARGET_H

#include "Texture2D.h"

namespace Cvekas {

// TODO: mipmap support
// TODO: usage as displacement map
// TODO: different depth/stencil support
// TODO: antialiasing support

/// Texture which can be rendered to
class RenderTarget: public Texture2D
{
public:
	/// Constructor for render target. You shouldn't construct %RenderTarget yourself, TextureManager does this.
	RenderTarget(ResourceId id, D3DDevicePtr device, const std::string& name, uint width, uint heigh,
		D3DFORMAT format);

	/// Destructor
	virtual ~RenderTarget();

	IDirect3DSurface9* getD3DSurface();

	/// You shouldn't call this
	virtual void onDeviceLost();
	/// You shouldn't call this
	virtual void onDeviceReset();

private:
	void create();

	IDirect3DSurface9* rt_surface;
};

typedef boost::shared_ptr<RenderTarget> RenderTargetPtr;

} // namespace

#endif